<script setup lang="ts">
import DirectItem from './direct-item.vue';
import type { accData } from '../types';
import { DIRECT_REASON_LIST } from '../constants/index';
import { findNameById } from '@/utils/array';

interface IProps {
  data?: accData;
}

const props = defineProps<IProps>();

const emit = defineEmits(['click']);
</script>

<template>
  <view class="view-shadow p-4" @click="emit('click')">
    <view class="flex text-14 color-gray-7">
      <view class="flex-1 flex">
        <app-infor-tag type="primary" :name="data.orderId" />
        <app-infor-tag class="ml-2" type="primary" :name="data.directrgMan" />
        <app-infor-tag class="ml-2" :name="findNameById(data.directReason, DIRECT_REASON_LIST)" />
      </view>
      <up-icon size="14" name="arrow-right"></up-icon>
    </view>
    <direct-item
      class="block mt-4"
      title="运输地点"
      :content="`${data.tranposId}/${data.tranposName}`"
    />
    <direct-item
      class="block mt-1"
      title="物流中心"
      :content="`${data.logistCenterId}/${data.logistCenterName}`"
    />
    <direct-item class="block mt-1" title="创建日期" :content="data.creDate" />
  </view>
</template>
